package cn.zebra.dev.admin.module.menu.service;

import cn.zebra.dev.admin.module.menu.entity.AdminMenuEntity;
import cn.zebra.dev.base.module.menu.service.BaseMenuService;
import cn.zebra.dev.ibatis.plus.service.IService;
import cn.zebra.dev.ibatis.plus.utils.PageUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import java.util.List;
import java.util.Map;

/**
 * 后台菜单管理
 *
 * @author runnable
 * @date 2019-09-07 16:59:45
 */
public interface AdminMenuService extends IService<AdminMenuEntity>, BaseMenuService<AdminMenuEntity> {

    @Override
    default List<AdminMenuEntity> findList() {
        LambdaQueryWrapper<AdminMenuEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(AdminMenuEntity::getDeleteFlag, false);
        return this.list(wrapper);
    }

    PageUtils<AdminMenuEntity> queryPage(Map<String, Object> params);

    /**
     * 查找用户菜单
     *
     * @param adminId 后台用户id
     * @return 用户对应菜单
     */
    List<AdminMenuEntity> findAdminUserMenuList(Long adminId);

    List<AdminMenuEntity> queryList();

    /**
     * 保存菜单 Admin端
     *
     * @param entity   菜单表单对象
     * @param createId 创建人用户id
     * @return 成功返回 true 失败false
     */
    Boolean saveMenu(AdminMenuEntity entity, Long createId);

    /**
     * 保存菜单 Admin端
     *
     * @param entity   菜单表单对象
     * @param updateId 修改人用户id
     * @return 成功返回 true 失败false
     */
    Boolean updateMenu(Long id, AdminMenuEntity entity, Long updateId);

    /**
     * 根据父菜单，查询子菜单
     *
     * @param id 父菜单ID
     */
    List<AdminMenuEntity> queryListParentId(Long id);

    /**
     * 保存菜单 Admin端
     *
     * @param id 被删除的菜单id
     * @return 成功返回 true 失败false
     */
    Boolean deleteMenu(Long id);

    List<AdminMenuEntity> findNotButtonList();

    List<AdminMenuEntity> getChildren(List<AdminMenuEntity> allList, Long parentId);

    @Override
    AdminMenuEntity findById(Long id);
}

